#!/usr/bin/python
# -*- coding: utf-8 -*-

from pprint import pprint

def main():
    m=[[1,2,3,4,5,6,7,8,9,10,11,12,13],
        [7,9,13,15,16,17,18,19,20,21,22,23],
        [17,19,20,21,22,23,24,25,26,27,28,19],
        [24,25,27,30,31,32,33,34,35,36,37,38,39,49,50],
        [3,4,5,6,7,8,33,45,46,47,56,57,58,59],
        [46,47,58,70,71,83,54,65,76,81,93,94],
        [100,101,102,103,104,105,106,107,120,121,123,125,146,147],
        [89,90,91,95,103,104,105,137,148,159,198,199,201]]
    s1=[]
    for i in range(len(m)):
        m[i]=list(set(m[i])-set(s1))
        s1.extend(m[i])
        s1=list(set(s1))
    pprint(m)

if __name__ == '__main__':
    main()
